import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, Index } from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';

@Entity('order_info',{database:'daijia_order'}) // 指定数据库表名
export class OrderInfo {
  @ApiProperty({ description: '订单ID', example: 1 })
  @PrimaryGeneratedColumn({ type: 'bigint', name: 'id',  comment: '订单ID' })
  id: number;

  @ApiProperty({ description: '用户ID', example: 12345 })
  @Column({ type: 'bigint', nullable: false, default: 0, comment: '用户ID' })
  customer_id: number;

  @ApiProperty({ description: '订单编号', example: 'ORDER123456789' })
  @Column({ type: 'varchar', length: 50, nullable: false, default: '', comment: '订单编号' })
  order_no: string;

  @ApiProperty({ description: '起点位置', example: '北京市朝阳区某街道' })
  @Column({ type: 'varchar', length: 200, nullable: false, default: '', comment: '起点位置' })
  start_location: string;

  @ApiProperty({ description: '起点经度', example: 116.397428 })
  @Column({ type: 'decimal', precision: 10, scale: 7, nullable: false, default: '0.0000000', comment: '起点经度' })
  start_point_longitude: number;

  @ApiProperty({ description: '起点纬度', example: 39.90923 })
  @Column({ type: 'decimal', precision: 10, scale: 7, nullable: false, default: '0.0000000', comment: '起点纬度' })
  start_point_latitude: number;

  @ApiProperty({ description: '终点位置', example: '北京市海淀区某街道' })
  @Column({ type: 'varchar', length: 200, nullable: false, default: '', comment: '终点位置' })
  end_location: string;

  @ApiProperty({ description: '终点经度', example: 116.407526 })
  @Column({ type: 'decimal', precision: 10, scale: 7, nullable: false, default: '0.0000000', comment: '终点经度' })
  end_point_longitude: number;

  @ApiProperty({ description: '终点纬度', example: 39.91379 })
  @Column({ type: 'decimal', precision: 10, scale: 7, nullable: false, default: '0.0000000', comment: '终点纬度' })
  end_point_latitude: number;

  @ApiProperty({ description: '预计距离（单位：公里）', example: 10.5 })
  @Column({ type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '预计距离（单位：公里）' })
  expect_distance: number;

  @ApiProperty({ description: '实际距离（单位：公里）', example: 11.2 })
  @Column({ type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '实际距离（单位：公里）' })
  real_distance: number;

  @ApiProperty({ description: '预计金额（单位：元）', example: 50.0 })
  @Column({ type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '预计金额（单位：元）' })
  expect_amount: number;

  @ApiProperty({ description: '实际金额（单位：元）', example: 55.0 })
  @Column({ type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '实际金额（单位：元）' })
  real_amount: number;

  @ApiProperty({ description: '优惠金额（单位：元）', example: 5.0 })
  @Column({ type: 'decimal', precision: 10, scale: 2, nullable: false, default: 0.0, comment: '优惠金额（单位：元）' })
  favour_fee: number;

  @ApiProperty({ description: '司机ID', example: 67890, required: false })
  @Column({ type: 'bigint', nullable: true, comment: '司机ID' })
  driver_id: number;

  @ApiProperty({ description: '接单时间', example: '2023-01-01T12:00:00Z', required: false })
  @Column({ type: 'datetime', nullable: true, comment: '接单时间' })
  accept_time: Date;

  @ApiProperty({ description: '到达时间', example: '2023-01-01T12:15:00Z', required: false })
  @Column({ type: 'datetime', nullable: true, comment: '到达时间' })
  arrive_time: Date;

  @ApiProperty({ description: '开始服务时间', example: '2023-01-01T12:20:00Z', required: false })
  @Column({ type: 'datetime', nullable: true, comment: '开始服务时间' })
  start_service_time: Date;

  @ApiProperty({ description: '结束服务时间', example: '2023-01-01T12:40:00Z', required: false })
  @Column({ type: 'datetime', nullable: true, comment: '结束服务时间' })
  end_service_time: Date;

  @ApiProperty({ description: '支付时间', example: '2023-01-01T12:45:00Z', required: false })
  @Column({ type: 'datetime', nullable: true, comment: '支付时间' })
  pay_time: Date;

  @ApiProperty({ description: '取消规则ID', example: 1, required: false })
  @Column({ type: 'bigint', nullable: true, comment: '取消规则ID' })
  cancel_rule_id: number;

  @ApiProperty({ description: '车牌号', example: '京A12345' })
  @Column({ type: 'varchar', length: 20, nullable: false, default: '', comment: '车牌号' })
  car_license: string;

  @ApiProperty({ description: '车型', example: 'SUV' })
  @Column({ type: 'varchar', length: 20, nullable: false, default: '', comment: '车型' })
  car_type: string;

  @ApiProperty({ description: '车辆正面照片URL', example: 'http://example.com/car_front.jpg', required: false })
  @Column({ type: 'varchar', length: 200, nullable: true, comment: '车辆正面照片URL' })
  car_front_url: string;

  @ApiProperty({ description: '车辆背面照片URL', example: 'http://example.com/car_back.jpg', required: false })
  @Column({ type: 'varchar', length: 200, nullable: true, comment: '车辆背面照片URL' })
  car_back_url: string;

  @ApiProperty({ description: '交易ID', example: 'TXN123456789', required: false })
  @Column({ type: 'varchar', length: 50, nullable: true, comment: '交易ID' })
  transaction_id: string;

  @ApiProperty({ description: '任务ID', example: 98765, required: false })
  @Column({ type: 'bigint', nullable: true, comment: '任务ID' })
  job_id: number;

  @ApiProperty({
    description: '订单状态：1-待接单，2-已接单，3-已出发，4-已到达，5-服务中，6-已完成，7-已取消，8-异常',
    example: 1,
  })
  @Column({ type: 'tinyint', nullable: false, default: 1, comment: '订单状态' })
  status: number;

  @ApiProperty({ description: '备注', example: '客户要求快速送达', required: false })
  @Column({ type: 'varchar', length: 200, nullable: true, comment: '备注' })
  remark: string;

  @ApiProperty({ description: '创建时间', example: '2023-01-01T12:00:00Z' })
  @CreateDateColumn({
    type: 'timestamp',

    comment: '创建时间',
  })
  create_time: Date;

  @ApiProperty({ description: '更新时间', example: '2023-01-01T12:00:00Z' })
  @UpdateDateColumn({
    type: 'timestamp',

    comment: '更新时间',
  })
  update_time: Date;

  @ApiProperty({ description: '是否删除：0-未删除，1-已删除', example: 0 })
  @Column({ type: 'tinyint', nullable: false, default: 0, comment: '是否删除' })
  is_deleted: number;
}